﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:local="clr-namespace:OMANE.Modules.Indicateurs"
    xmlns:converters="clr-namespace:OMANE.Modules.Indicateurs.Views.Converters"
    xmlns:selectors="clr-namespace:OMANE.Modules.Indicateurs.Views.Selectors"
	xmlns:ig="http://schemas.infragistics.com/xaml"    
	mc:Ignorable="d"
	x:Class="Views.V2ViewGraphEditor"
	>

    <UserControl.Resources>
        <converters:InvertConverter x:Key="Inverter" />
        <local:BrushColorConverter x:Key="BrushColorConverter" />
        <local:ObjectVerticalAlignmentConverter x:Key="ObjectVerticalAlignmentConverter" />
        <local:ObjectHorizontalAlignmentConverter x:Key="ObjectHorizontalAlignmentConverter" />
    </UserControl.Resources>
    <Grid>
        <TabControl >
            <TabItem Header="Positionnement">
                <Grid Background="#FFE5E5E5" >
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
						<RowDefinition />
                        <RowDefinition />
                        <RowDefinition />
						<RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="5"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <GridSplitter HorizontalAlignment="Stretch" Grid.Column="1" Grid.RowSpan="8" />
                    <Grid >
                        <TextBlock Text="Largeur" />
                    </Grid>
                    <Grid Grid.Column="2" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=WidthAuto, Mode=TwoWay, Converter={StaticResource Inverter}}" >
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}" Text="{Binding Path=Width}"/>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="1" >
                        <TextBlock Text="Hauteur" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="1" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=HeightAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=Height}"/>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="2" >
                        <TextBlock Text="Gauche" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="2" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=LeftAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=MarginLeft}"/>
                        </CheckBox>
                    </Grid>
                    <Grid  Grid.Row="3" >
                        <TextBlock Text="Haut" />
                    </Grid>
                    <Grid Grid.Column="2"  Grid.Row="3" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=TopAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=MarginTop}"/>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="4" >
                        <TextBlock Text="Droite" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="4" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=RightAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=MarginRight}"/>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="5" >
                        <TextBlock Text="Bas" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="5" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=BottomAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=MarginBottom}"/>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="6" >
                        <TextBlock Text="Alignement Horizontal" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="6" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=HAlignAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <ComboBox SelectedIndex="{Binding Path=HorizontalAlignment, Mode=TwoWay, Converter={StaticResource ObjectHorizontalAlignmentConverter}}" IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  >
                                <sys:String>A Gauche</sys:String>
                                <sys:String>Centré</sys:String>
                                <sys:String>A Droite</sys:String>
                                <sys:String>Plein</sys:String>
                            </ComboBox>
                        </CheckBox>
                    </Grid>
                    <Grid Grid.Row="7" >
                        <TextBlock Text="Alignement Vertical" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="7" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=VAlignAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <ComboBox SelectedIndex="{Binding Path=VerticalAlignment, Mode=TwoWay, Converter={StaticResource ObjectVerticalAlignmentConverter}}" IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}">
                                <sys:String>En Haut</sys:String>
                                <sys:String>Centré</sys:String>
                                <sys:String>En Bas</sys:String>
                                <sys:String>Plein</sys:String>
                            </ComboBox>
                        </CheckBox>
                    </Grid>
					 <Grid Grid.Row="8" >
                        <TextBlock Text="Couleur Arriere-Plan" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="8" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=BackColorAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <ig:XamColorPicker IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}" SelectedColor="{Binding Path=Background, Mode=TwoWay, Converter={StaticResource BrushColorConverter}}" />
                        </CheckBox>
                    </Grid>
					 <Grid Grid.Row="9" >
                        <TextBlock Text="Couleur Bordure" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="9" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=BorderColorAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                            <ig:XamColorPicker IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  SelectedColor="{Binding Path=BorderBrush, Mode=TwoWay, Converter={StaticResource BrushColorConverter}}"  />
                        </CheckBox>
                    </Grid>
					 <Grid Grid.Row="10" >
                        <TextBlock Text="Epaisseur Bordure" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="10" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=BorderSizeAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                           <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=BorderSize}"/>
                        </CheckBox>
                    </Grid>
					 <Grid Grid.Row="11" >
                        <TextBlock Text="Rayon Bordure" />
                    </Grid>
                    <Grid Grid.Column="2" Grid.Row="11" >
                        <CheckBox HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" IsChecked="{Binding Path=CornerRadiusAuto, Mode=TwoWay, Converter={StaticResource Inverter}}">
                             <TextBox IsEnabled="{Binding RelativeSource={RelativeSource AncestorType=CheckBox}, Path=IsChecked}"  Text="{Binding Path=CornerRadius}"/>
                         </CheckBox>
                    </Grid>
                </Grid>
            </TabItem>
            <TabItem Header="Données">
                <Grid Background="#FFE5E5E5">
                    <StackPanel DataContext="{x:Static local:DataProviderService.Providers}">
                        <ComboBox ItemsSource="{Binding}" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True"  />
                        <ComboBox ItemsSource="{Binding Path=/Sources}" DisplayMemberPath="Name" IsSynchronizedWithCurrentItem="True" />
                        <ComboBox ItemsSource="{Binding Path=/Sources/Members}"  IsSynchronizedWithCurrentItem="True" />
                    </StackPanel>
                </Grid>
            </TabItem>
            <TabItem Header="Detail">
                <Grid Background="#FFE5E5E5">
                    <ContentControl Content="{Binding Zone}" />
                </Grid>
            </TabItem>
            <TabItem Header="Commandes">
                <Grid Background="#FFE5E5E5">
                    <ListBox ItemsSource="{Binding Zone.CommandGroups[0].Commands}" Background="{x:Null}" BorderBrush="{x:Null}" BorderThickness="0">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="ListBoxItem">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="ListBoxItem">
                                            <Button RenderTransformOrigin="0.5 0.5" Content="{Binding Name}" Command="{Binding}" >
                                                <Button.Template>
                                                    <ControlTemplate TargetType="Button">
                                                        <Border  BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" CornerRadius="5" BorderThickness="{TemplateBinding BorderThickness}" Padding="5">
                                                            <ContentPresenter ContentSource="Content" HorizontalAlignment="Center" VerticalAlignment="Center" />
                                                        </Border>
                                                        <ControlTemplate.Triggers>
                                                            <Trigger Property="IsMouseOver" Value="true">
                                                                <Setter Property="BorderThickness" Value="3" />
                                                                <Setter Property="BorderBrush" Value="Black" />
                                                            </Trigger>
                                                            <Trigger Property="IsPressed" Value="true">
                                                                <Setter Property="RenderTransform">
                                                                    <Setter.Value>
                                                                        <ScaleTransform ScaleX="0.9" ScaleY="0.9" />
                                                                    </Setter.Value>
                                                                </Setter>
                                                            </Trigger>
                                                        </ControlTemplate.Triggers>
                                                    </ControlTemplate>
                                                </Button.Template>
                                            </Button>
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </ListBox.ItemContainerStyle>
                    </ListBox>
                </Grid>
            </TabItem>
        </TabControl>
    </Grid>
</UserControl>